<template>
  <div class="home">
    <img alt="Vue logo" src="../assets/logo.png" />
    <HelloWorld msg="Welcome to Your Vue.js App" />
    <ul>
      <li v-for="item of $store.state.userInfo" :key="item">
        {{ item }}
      </li>
    </ul>
  </div>
</template>

<script>
import HelloWorld from "@/components/HelloWorld.vue";

export default {
  name: "home",
  data() {
    return {
      stopAsyncData: this.$store.state.userInfo
    }
  },
  async asyncData({ store, route }) {
    console.log('run')
    return store.dispatch("fetchUserInfo", {
      id:'home',// 用 home 本身来模拟 id
      url:route.fullPath
    });
  },
  components: {
    HelloWorld
  }
};
</script>
